package com.bnyy.message.bean.chat.message_data;

import android.text.TextUtils;

import com.bnyy.message.enums.MessageType;
import com.google.gson.JsonObject;
import com.google.gson.annotations.SerializedName;

import org.xutils.db.annotation.Column;
import org.xutils.db.annotation.Table;

/**
 * Author : 关炳鹏
 * Description :
 * Date : 2022/12/9
 **/
@Table(name = "message_invitation")
public class InvitationMessage extends MessageData {

    public interface ColumnName {
        String ID = "id";
        String GROUP_CHAT_LEADER_IMG = "img";
        String CONTENT = "content";
        String TITLE = "title";
    }

    @Column(name = ColumnName.ID)
    private int id;
    @Column(name = ColumnName.GROUP_CHAT_LEADER_IMG)
    @SerializedName("img")
    private String img;
    @Column(name = ColumnName.CONTENT)
    private String content;
    @Column(name = ColumnName.TITLE)
    private String title = "邀请你加入群聊";

    public InvitationMessage() {
    }

    public InvitationMessage(String msgId, JsonObject jsonObject) {
        super(msgId, jsonObject);
        setId(jsonObject.get(ColumnName.ID).getAsInt());
        setContent(jsonObject.get(ColumnName.CONTENT).getAsString());
        setTitle(jsonObject.get(ColumnName.TITLE).getAsString());
        setImg(jsonObject.get(ColumnName.GROUP_CHAT_LEADER_IMG).getAsString());
    }

    @Override
    public MessageType getMessageType() {
        return MessageType.GROUP_CHAT_INVITATION;
    }

    public String getContent() {
        return TextUtils.isEmpty(content) ? "" : content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getTitle() {
        return TextUtils.isEmpty(title) ? "邀请你加入群聊" : title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }
}
